home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QuickTime - The Beta Release
/
QuickTime - The Beta Release.iso
/
Programming Stuff
/
Interfaces
/
Oldstyle C Interfaces
/
image compression.h
< prev
next >
Wrap
Text File
|
1991-09-06
|
41KB
|
1,468 lines
/*
File: Image Compression.h
Contains: Image Compression Manager definitions
Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
*/
#ifndef __CODEC__
#define __CODEC__
#include <QuickDraw.h>
#include <QDOffscreen.h>
#include <Types.h>
#if THINK_C == 1
#define PASCAL /* for some reason Think C doesn't like pascal type for ProcPtrs */
#else
#define PASCAL pascal
#endif
#include "Components.h"
#include "Matrix.h"
#ifdef CODEC_MGR_VERSION
#if CODEC_MGR_VERSION != 15
WRONG CODEC_MGR_VERSION
#endif
#endif
#define gestaltCompressionMgr 'icmp'
/*
These are the bits that are set in the Component flags, and also in the codecInfo struct.
*/
#define codecInfoDoes1 (1L<<0) /* codec can work with 1-bit pixels */
#define codecInfoDoes2 (1L<<1) /* codec can work with 2-bit pixels */
#define codecInfoDoes4 (1L<<2) /* codec can work with 4-bit pixels */
#define codecInfoDoes8 (1L<<3) /* codec can work with 8-bit pixels */
#define codecInfoDoes16 (1L<<4) /* codec can work with 16-bit pixels */
#define codecInfoDoes32 (1L<<5) /* codec can work with 32-bit pixels */
#define codecInfoDoesDither (1L<<6) /* codec can do ditherMode */
#define codecInfoDoesStretch (1L<<7) /* codec can stretch to arbitrary sizes */
#define codecInfoDoesShrink (1L<<8) /* codec can shrink to arbitrary sizes */
#define codecInfoDoesMask (1L<<9) /* codec can mask to clipping regions */
#define codecInfoDoesTemporal (1L<<10) /* codec can handle temporal redundancy */
#define codecInfoDoesDouble (1L<<11) /* codec can stretch to double size exactly */
#define codecInfoDoesQuad (1L<<12) /* codec can stretch to quadruple size exactly */
#define codecInfoDoesHalf (1L<<13) /* codec can shrink to half size */
#define codecInfoDoesQuarter (1L<<14) /* codec can shrink to quarter size */
#define codecInfoDoesRotate (1L<<15) /* codec can rotate on decompress */
#define codecInfoDoesHorizFlip (1L<<16) /* codec can flip horizontally on decompress */
#define codecInfoDoesVertFlip (1L<<17) /* codec can flip vertically on decompress */
#define codecInfoDoesSkew (1L<<18) /* codec can skew on decompress */
#define codecInfoDoesBlend (1L<<19) /* codec can blend on decompress */
#define codecInfoDoesWarp (1L<<20) /* codec can warp arbitrarily on decompress */
#define codecInfoDoesRecompress (1L<<21) /* codec can recompress image
without accumulating errors */
#define codecInfoDepth1 (1L<<0) /* compressed data at 1 bpp depth available */
#define codecInfoDepth2 (1L<<1) /* compressed data at 2 bpp depth available */
#define codecInfoDepth4 (1L<<2) /* compressed data at 4 bpp depth available */
#define codecInfoDepth8 (1L<<3) /* compressed data at 8 bpp depth available */
#define codecInfoDepth16 (1L<<4) /* compressed data at 16 bpp depth available */
#define codecInfoDepth32 (1L<<5) /* compressed data at 32 bpp depth available */
#define codecInfoDepth24 (1L<<6) /* compressed data at 24 bpp depth available */
#define codecInfoDepth33 (1L<<7) /* compressed data at 1 bpp monochrome depth available */
#define codecInfoDepth34 (1L<<8) /* compressed data at 2 bpp grayscale depth available */
#define codecInfoDepth36 (1L<<9) /* compressed data at 4 bpp grayscale depth available */
#define codecInfoDepth40 (1L<<10) /* compressed data at 8 bpp grayscale depth available */
#define codecInfoStoresClut (1L<<11) /* compressed data can have custom cluts */
#define codecFlagUseImageBuffer (1L<<0) /* (input) allocate buffer for whole image on decompress sequence */
#define codecFlagUseScreenBuffer (1L<<1) /* (input) allocate buffer for screen on decompress sequence for faster updates */
#define codecFlagUpdatePrevious (1L<<2) /* (input) udate previous buffer on compress sequence */
#define codecFlagNoScreenUpdate (1L<<3) /* (input) dont update screen, but do update image buffer if allocated */
#define codecFlagWasCompressed (1L<<4) /* (input) hint to compressor that image was previously compressed */
#define codecFlagDontOffscreen (1L<<5) /* return error instead of automatically going offscreen */
#define codecFlagUpdatePreviousComp (1L<<6) /* (input) udate previous buffer on compress sequence */
#define codecFlagForceKeyFrame (1L<<7) /* when sent to CompressSequenceFrame, forces that frame to be a key frame */
#define codecFlagOnlyScreenUpdate (1L<<8) /* (input) only update screen from */
#define codecFlagLiveGrab (1L<<9) /* (input) data being compressed is from live source (speed is critical) */
#define codecFlagUsedNewImageBuffer (1L<<14) /* (output) indicates that image buffer was first used on this decompress sequence */
#define codecFlagUsedImageBuffer (1L<<15) /* (output) indicates that image buffer was used on this decompress sequence */
#define codecErr -8960 /* the codec returned an error */
#define noCodecErr -8961 /* the specified codec could not be found */
#define codecUnimpErr -8962 /* this feature is not implemented by the specified codec */
#define codecSizeErr -8963
#define codecScreenBufErr -8964 /* the screen buffer could not be allocated */
#define codecImageBufErr -8965 /* the image buffer could not be allocated */
#define codecSpoolErr -8966 /* the compressed data must be in memory (spooling did not work) */
#define codecAbortErr -8967 /* the operation was aborted by the progress proc */
#define codecWouldOffscreenErr -8968 /* an offscreen access would have been used, but wasn't allowed because codecFlagDontOffscreen was set */
#define codecBadDataErr -8969 /* compressed data was found to have inconsistencies */
#define codecDataVersErr -8970 /* compressed data was of a format version that codec couldn't handle */
#define codecExtensionNotFoundErr -8971 /* requested image description extension could not be found */
#define codecMinimumBufferSize 16384 /* The minimum data size for spooling in or out data */
#define compressorComponentType 'imco' /* the type for "Components" which compress images */
#define decompressorComponentType 'imdc' /* the type for "Components" which decompress images */
typedef Component CompressorComponent; /* a Component which compresses images */
typedef Component DecompressorComponent; /* a Component which decompresses images */
typedef Component CodecComponent; /* a Component which decompresses or compresses images */
#define anyCodec ((CodecComponent)0) /* take first working codec of given type */
#define bestSpeedCodec ((CodecComponent)-1) /* take fastest codec of given type */
#define bestFidelityCodec ((CodecComponent)-2) /* take codec which is most accurate*/
#define bestCompressionCodec ((CodecComponent)-3) /* take codec of given type that is most accurate */
typedef short sBoolean; /* to make sure stack frames are right */
typedef long CodecType; /* type descriptor for codecs i.e: 'appl','jpeg','rle ' */
typedef unsigned short CodecFlags; /* flags for codec manager calls */
typedef unsigned long CodecQ; /* The quality is defined as a number between codecMinQuality
and codecMaxQuality with codecLowQuality being low quality and
codecHighQuality being high quality - intermediate values may
or may not be implemented by a particular codec, and the
closest integral level will be used - the actual value used
should be returned by the GetMaxSize Function.
The extremes of the range below codecLowQuality and above
codecHighQuality may give uneven results, but should be as
linear as possible numbers above codecMaxQuality are reserved
for each type of codec.
*/
#define codecLosslessQuality 0x400L
#define codecMaxQuality 0x3ffL
#define codecMinQuality 0x000L
#define codecLowQuality 0x100L
#define codecNormalQuality 0x200L
#define codecHighQuality 0x300L
typedef PASCAL OSErr (*DataProcPtr)(Ptr *dataP,long bytesNeeded,long refcon);
/* The DataProc is called by CoDecs when they need to get more
data than is in the buffer passed to them. They are called
with the original pointer and the number of bytes needed,
which will not exceed the number of bytes originally in the
buffer. If the data can not be returned an error code should
be returned.
If data is nil then the data buffer should be rewound to the
beginning of the datastream + bytesNeeded. Subsequent calls
should return data beginning from this location. If this can't
be done, then the dataProc should return an non-zero result.
*/
typedef PASCAL OSErr (*FlushProcPtr)(Ptr data,long bytesAdded,long refcon);
/* The FlushProc is called by CoDecs when they need to create
more data than fits in the buffer passed to them. They are
called with the original pointer and the number of bytes added
so far, which will not exceed the number of bytes originally
in the buffer. If all the data can not be obtained an non-zero
error should be returned.
If data is nil then the data buffer should be rewound to
the beginning of the datastream + bytes added.Subsequent calls
should put overwrite the data beginning at this location. If
this can't be done, then the flushProc should return an
non-zero result.
*/
typedef PASCAL void (*CompletionProcPtr)(OSErr result,short flags,long refcon);
/* The CompletionProc is called when an asynchronous call is
completed. The result is the on ly argument, but any
parameters set by the async call (including the resulting
data) are not valid until the CompletionProc is called.
*/
#define codecCompletionSource (1<<0)
#define codecCompletionDest (1<<1)
typedef PASCAL OSErr (*ProgressProcPtr)(short message,Fixed completeness,long refcon);
/* The ProgressProcPtr is called during compression or
decompression with a number that indicates the percent
complete (0-1.0). It also indicates abortion requests if
the result is not noErr.
*/
#define codecProgressOpen 0
#define codecProgressUpdatePercent 1
#define codecProgressClose 2
/*
StdPix bottleneck procedure. This is the CGrafProc newProc1 whenever the ICM is installed.
To pass in a compressed image it should be packed into a PixMap struct using
SetCompressedPixMapInfo. When intercepting it, you can determine if the PixMap
contains a compressed image by calling GetCompressedPixMapInfo.
*/
typedef PASCAL void (*StdPixProcPtr)(PixMap *src,Rect *srcRect,MatrixRecord *matrix,short mode,
RgnHandle mask,PixMap *matte,Rect *matteRect,short flags);
typedef long ImageSequence;
typedef struct {
ProgressProcPtr progressProc;
long progressRefCon;
} ProgressProcRecord;
typedef ProgressProcRecord *ProgressProcRecordPtr;
typedef struct {
CompletionProcPtr completionProc;
long completionRefCon;
} CompletionProcRecord;
typedef CompletionProcRecord *CompletionProcRecordPtr;
typedef struct {
DataProcPtr dataProc;
long dataRefCon;
} DataProcRecord;
typedef DataProcRecord *DataProcRecordPtr;
typedef struct {
FlushProcPtr flushProc;
long flushRefCon;
} FlushProcRecord;
typedef FlushProcRecord *FlushProcRecordPtr;
/*
The ImageDescription is private data which is produced when an image or sequence
is compressed. It fully describes the format of the compressed data.
*/
typedef struct ImageDescription {
long size; /* total size of ImageDescription including extra data ( CLUTs and other per sequence data */
CodecType cType; /* what kind of codec compressed this data */
long resvd1; /* reserved for apple use */
long resvd2; /* reserved for apple use */
short version; /* which version is this data */
short revisionLevel; /* what version of that codec did this */
long vendor; /* whose codec compressed this data */
CodecQ temporalQuality; /* what was the temporal quality factor */
CodecQ spatialQuality; /* what was the spatial quality factor */
short width; /* how many pixels wide is this data */
short height; /* how many pixels high is this data */
Fixed hRes; /* horizontal resolution */
Fixed vRes; /* vertical resolution */
long dataSize; /* if known, the size of data for this image descriptor */
short frameCount; /* number of frames this description applies to */
char name[32]; /* name of codec ( in case not installed ) */
short depth; /* what depth is this data (1-32) or ( 33-40 grayscale ) */
short clutID; /* clut id or if 0 clut follows or -1 if no clut */
} ImageDescription;
typedef ImageDescription *ImageDescriptionPtr;
typedef ImageDescription **ImageDescriptionHandle;
/*
The CodecInfo is the information returned as the codecInfo struct by a codec Component
to the codec manager or to the caller. It is specific to the particular codec
implementation and not to the codec type.
*/
typedef struct CodecInfo {
char typeName[32]; /* name of the codec type i.e.: 'Apple Image Compression' */
short version; /* version of the codec data that this codec knows about */
short revisionLevel; /* revision level of this codec i.e: 0x00010001 (1.0.1) */
long vendor; /* Maker of this codec i.e: 'appl' */
long decompressFlags; /* codecInfo flags for decompression capabilities */
long compressFlags; /* codecInfo flags for compression capabilities */
long formatFlags; /* codecInfo flags for compression format details */
unsigned char compressionAccuracy; /* measure (1-255) of accuracy of this codec for compress (0 if unknown) */
unsigned char decompressionAccuracy; /* measure (1-255) of accuracy of this codec for decompress (0 if unknown) */
unsigned short compressionSpeed; /* ( millisecs for compressing 320x240 on base mac II) (0 if unknown) */
unsigned short decompressionSpeed; /* ( millisecs for decompressing 320x240 on mac II)(0 if unknown) */
unsigned char compressionLevel; /* measure (1-255) of compression level of this codec (0 if unknown) */
char resvd; /* pad */
short minimumHeight; /* minimum height of image (block size) */
short minimumWidth; /* minimum width of image (block size) */
short decompressPipelineLatency; /* in milliseconds ( for asynchronous codecs ) */
short compressPipelineLatency; /* in milliseconds ( for asynchronous codecs ) */
long privateData;
} CodecInfo;
/*
Table used for fast dithering.
*/
typedef struct {
long tag;
long seed;
long reserved;
char data[1];
} DitherTable;
typedef DitherTable *DTabPtr;
typedef DitherTable **DTabHandle;
typedef DTabHandle *DTabHPtr;
/*
Name list returned by GetCodecNameList.
*/
typedef struct {
CodecComponent codec;
CodecType cType;
char typeName[32];
Handle name;
} CodecNameSpec;
typedef struct {
short count;
CodecNameSpec list[1];
}CodecNameSpecList;
typedef CodecNameSpecList *CodecNameSpecListPtr;
/*************************
CodecTrapVersion
This call returns the version of the codec manager installed.
Return values:
noErr
paramErr
*/
pascal OSErr
CodecManagerVersion(long *version)
= {0x7000+0x0000,0xAAA3}
;
/*************************
GetCodecNameList
This call returns a list of all the codecs installed at the time it is called. If showAll is
true then all the codecs of each type are returned, otherwise only the the typename is
returned once for each type of codec.This is useful for selecting codec parameters. Pass in a
pointer to an empty CodecNameSpecListPtr and the pointer will be allocated with the names
filled in. You can dispose this when you're done with DisposPtr.
Return values:
noErr
paramErr
*/
pascal OSErr
GetCodecNameList(CodecNameSpecListPtr *list,sBoolean showAll)
= {0x7000+0x0001,0xAAA3}
;
/*************************
GetCodecInfo
This routine returns information for the codec with the given type. The first codec of
the given type is used unless codec specifies a particular codec.
Return values:
noErr
codecErr
noCodecErr
paramErr
*/
pascal OSErr
GetCodecInfo(CodecInfo *info,CodecType cType,CodecComponent codec)
= {0x7000+0x0003,0xAAA3}
;
/*************************
GetMaxCompressionSize
This routine returns the maximum possible size in bytes that the compressed data will
be for the given parameters.
Return values:
noErr
codecErr
noCodecErr
paramErr
*/
pascal OSErr
GetMaxCompressionSize(PixMapHandle src,Rect *srcRect, short colorDepth,CodecQ quality,
CodecType cType,CompressorComponent codec,long *size)
= {0x7000+0x0004,0xAAA3}
;
/*************************
GetCompressionTime
The approximate compression time in milliseconds is returned for an image
with the given parameters.
Quality should be set to the desired spatial and temporal quality, in it
will be returned the closest actual quality that the codec can achieve from
the requested one.If the time is zero it should be considered indeterminate.
Return values:
noErr
codecErr
noCodecErr
paramErr
*/
pascal OSErr
GetCompressionTime(PixMapHandle src,Rect *srcRect, short colorDepth,
CodecType cType,CompressorComponent codec,
CodecQ *spatialQuality,CodecQ *temporalQuality,unsigned long *compressTime)
= {0x7000+0x0005,0xAAA3}
;
/*************************
CompressImage
This routine compresses a single image ( from a pixmap) with the given parameters.
Type specifies which compression format you want the data to be returned in.
Quality determines the quality of the compressed image (See description of CodecQ above).
ColorDepth tells the codec the pixel depth at which this image will most likely be viewed.
Some codecs will use this to determine the color resolution of the compressed image. You
can determine which depths are supported by GetCodecInfo or GetCodecDepthList. If colorDepth is
zero the best matching depth available for the compressor is used. If the depth you specify
is not available the closest possible depth that the compressor can do is used.
The compressed data is placed in dataPtr.
The actual number of bytes resulting is placed in the dataSize field of the image description
when the call is completed successfully.
The ImageDescription should be passed as an empty handle, and the handle will
sized and filled with additional data for this image which should be kept with the
compressed data.
Codec could be a specific codec or one of the special
codec selectors (anyCodec,bestSpeedCodec, etc ).
The color table is optional, and nil should be passed if it is not needed.
the optional Progress proc is called as the operation progresses, and may abort it.
The compressed data is written into the given pointer, and the number
of bytes added is indicated by the BufferSize field of the ImageDescription.
Return values:
noErr
codecErr
codecAbortErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
CompressImage(PixMapHandle src,Rect *srcRect,CodecQ quality,CodecType cType,
ImageDescriptionHandle desc,Ptr data)
= {0x7000+0x0006,0xAAA3}
;
pascal OSErr
FCompressImage(PixMapHandle src,Rect *srcRect, short colorDepth,
CodecQ quality,CodecType cType,CompressorComponent codec,CTabHandle clut,
CodecFlags flags,long bufferSize,
FlushProcRecordPtr flushProc,ProgressProcRecordPtr progressProc, ImageDescriptionHandle desc,Ptr data)
= {0x7000+0x0007,0xAAA3}
;
/*************************
DecompressImage
This routine decompresses a single image to a pixmap with the given parameters.
ImageDescription is a pointer to the additional data generated by CompressImage.
The compressed data should be pointed to by data.
The dstPixMap, dstRect, mode and mask determine how the image
will be displayed (similar to copybits).
If matrix is not nil, it is used to position the decompressed image in the destination,
this can be used to perform flips, warps or rotations, as well as simple translation and
scaling.
If matte is not nil then it will be used as a blend matte to blend the image into the
background of the pixmap as in CopyDeepMask. The matte can be any depth, but should be
the size of the source image.
Mask is similar to matte, except it is the size of the destination image, and it is a
standard region.
The port and gdevice should be set to match the destination pixmap, as in CopyBits.
If picSave is true for the current GrafPort, the compressed image will be stored
in the currently open picture. The matte, mask and matrix are also stored in the
picture with the compressed picture.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
DecompressImage(Ptr data,ImageDescriptionHandle desc,PixMapHandle dst,
Rect *srcRect,Rect *dstRect,short mode,RgnHandle mask)
= {0x7000+0x0008,0xAAA3}
;
pascal OSErr
FDecompressImage(Ptr data,ImageDescriptionHandle desc,PixMapHandle dst,Rect *srcRect,
MatrixRecordPtr matrix,short mode,RgnHandle mask,
PixMapHandle matte,Rect *matteRect,
CodecQ accuracy,DecompressorComponent codec,
long bufferSize,DataProcRecordPtr dataProc,ProgressProcRecordPtr progressProc)
= {0x7000+0x0009,0xAAA3}
;
/*************************
CompressSequenceBegin
This routine begins the compression of a sequence of compressed frames.
ColorDepth tells the codec the pixel depth at which this image will most likely be viewed.
Some codecs will use this to determine the color resolution of the compressed image. You
can determine which depths are supported by GetCodecInfo or GetCodecDepthList. If colorDepth is
zero the best matching depth available for the compressor is used. If the depth you specify
is not available the closest possible depth that the compressor can do is used.
If temporalQuality is not zero, then the compressor may use information from the "prev" PixMap to reduce redundancy. The
keyFrameRate parameter hints at how often to force a full key frame into the sequence.
The key frames may be placed at more frequent intervals if needed - if you must
have keyframes at a fixed rate or at particular frames, the temporalQuality
can be changed on a per frame basis as needed ( 0 forces a key frame ). If keyFrameRate
is zero, they will never be any key frames.
If the codecFlag codecFlagUpdatePrevious flag is true, and
temporalQuality is not zero the src PixMap is copied into the prev PixMap by the codec.
If prev is nil and temporalQuality is not zero, then an offscreen
GWorld will be temporarily allocated and used for the sequence
( this assumes copyframe will be used to keep the prev data up to date.)
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
CompressSequenceBegin(ImageSequence *seqID,PixMapHandle src,PixMapHandle prev,
Rect *srcRect,Rect *prevRect,short colorDepth,CodecType cType,CompressorComponent codec,
CodecQ spatialQuality,CodecQ temporalQuality,long keyFrameRate,
CTabHandle clut,CodecFlags flags,ImageDescriptionHandle desc)
= {0x7000+0x000a,0xAAA3}
;
/*************************
CompressSequenceFrame
This should be called for subsequent frames with the seqID returned with the
CompressSequenceFirst call. It acts like the CompressSequenceBegin call with the exception
of the similarity parameter, in which ( if it is not nil ) the similarity
between the previous frame and the current frame is returned. If similarity is
0 then the frame is a guaranteed key frame, if it is 255 it is identical with the
previous frame otherwise it ranges from 254 (very similar) to 1 (very different).
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
codecSequenceErr
*/
pascal OSErr
CompressSequenceFrame(ImageSequence seqID,PixMapHandle src,Rect *srcRect,
CodecFlags flags,Ptr data,long *dataSize,
unsigned char *similarity,CompletionProcRecordPtr asyncCompletionProc)
= {0x7000+0x000b,0xAAA3}
;
/*************************
DecompressSequenceBegin
This routine sets up the codec manager to begin decompressing a sequence of compressed
images. The sequence must be of all the same compression type.
if the codecFlag codecFlagUseScreenBuffer is true, an offscreen buffer the size of
the destination is allocated and decompressed data will be written there, and then
copied to the destination. This can be used to reduce tearing that may happen in some
cases when decompressing directly to a screen. If the codecFlag
codecFlagUseImageBuffer is set, then an offscreen buffer the size of the compressed
data will be created. This would allow updates to work correctly for data that is
temporally compressed, since a full copy of the frame in progress will always be
available.
The dstPixMap, dstRect, mode and mask determine how the image will be displayed
(similar to copybits).
If matrix is not nil, it is used to position the decompressed image in the destination,
this can be used to perform flips, warps or rotations.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
codecSequenceErr
codecScreenBufErr
codecImageBufErr
*/
pascal OSErr
DecompressSequenceBegin(ImageSequence *seqID,ImageDescriptionHandle desc,
CGrafPtr port,GDHandle gdh,Rect *srcRect,MatrixRecordPtr matrix,
short mode,RgnHandle mask,CodecFlags flags,CodecQ accuracy,DecompressorComponent codec)
= {0x7000+0x000d,0xAAA3}
;
/*************************
DecompressSequenceFrame
This routine decompresses frames of a sequence to a pixmap with the given parameters.
The data is taken from the pointer data. LastFrame should be set to true for the last
frame of the sequence. If asyncCompletionProc is not nil, than the call is performed
asynchronously,and will return to the caller immediately, but the data will not be
valid until the asyncCompletionProc is called. If the codecFlag codecFlagNoScreenUpdate is true,
then only the offscreen image buffer will be updated.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
codecSequenceErr
*/
pascal OSErr
DecompressSequenceFrame(ImageSequence seqID,Ptr data,
CodecFlags inFlags,CodecFlags *outFlags,CompletionProcRecordPtr asyncCompletionProc)
= {0x7000+0x000e,0xAAA3}
;
pascal OSErr
SetDSequenceMatrix(ImageSequence seqID,MatrixRecordPtr matrix)
= {0x7000+0x0010,0xAAA3}
;
pascal OSErr
SetDSequenceMatte(ImageSequence seqID,PixMapHandle matte,Rect *matteRect)
= {0x7000+0x0011,0xAAA3}
;
pascal OSErr
SetDSequenceMask(ImageSequence seqID,RgnHandle mask)
= {0x7000+0x0012,0xAAA3}
;
pascal OSErr
SetDSequenceTransferMode(ImageSequence seqID,short mode,RGBColor *opColor)
= {0x7000+0x0013,0xAAA3}
;
pascal OSErr
SetDSequenceDataProc(ImageSequence seqID,DataProcRecordPtr dataProc,long bufferSize)
= {0x7000+0x0014,0xAAA3}
;
pascal OSErr
SetDSequenceAccuracy(ImageSequence seqID,CodecQ accuracy)
= {0x7000+0x0034,0xAAA3}
;
pascal OSErr
SetDSequenceSrcRect(ImageSequence seqID,Rect *srcRect)
= {0x7000+0x0035,0xAAA3}
;
pascal OSErr
GetDSequenceImageBuffer(ImageSequence seqID,GWorldPtr *gworld)
= {0x7000+0x0015,0xAAA3};
pascal OSErr
GetDSequenceScreenBuffer(ImageSequence seqID,GWorldPtr *gworld)
= {0x7000+0x0016,0xAAA3};
pascal OSErr
SetCSequenceQuality(ImageSequence seqID,CodecQ spatialQuality,CodecQ temporalQuality)
= {0x7000+0x0017,0xAAA3}
;
pascal OSErr
SetCSequencePrev(ImageSequence seqID,PixMapHandle prev,Rect *prevRect)
= {0x7000+0x0018,0xAAA3}
;
pascal OSErr
SetCSequenceFlushProc(ImageSequence seqID,FlushProcRecordPtr flushProc,long bufferSize)
= {0x7000+0x0033,0xAAA3}
;
pascal OSErr
SetCSequenceKeyFrameRate(ImageSequence seqID,long keyframerate)
= {0x7000+0x0036,0xAAA3}
;
pascal OSErr
GetCSequencePrevBuffer(ImageSequence seqID,GWorldPtr *gworld)
= {0x7000+0x0019,0xAAA3};
pascal OSErr
CDSequenceBusy(ImageSequence seqID)
= {0x7000+0x001a,0xAAA3}
;
/*************************
SequenceEnd
This call should be made when done with compressing or decompressing a sequence.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
codecSequenceErr
*/
pascal OSErr
CDSequenceEnd(ImageSequence seqID)
= {0x7000+0x001b,0xAAA3}
;
/*************************
GetCompressedImageSize
Normally the dataSize field in the ImageDescription indicates the size
in bytes of the image data. If the image is from a sequence you may need to
determine the size from the data alone.
This routine returns the size of the compressed data for the codec with the
given type. It is used for parsing a combined input stream. If type is zero,
the proper codec will be used.
Return values:
noErr
codecErr
noCodecErr
paramErr
*/
pascal OSErr
GetCompressedImageSize(ImageDescriptionHandle desc,Ptr data,long bufferSize,
DataProcRecordPtr dataProc,long *dataSize)
= {0x7000+0x001c,0xAAA3}
;
/*************************
GetSimilarity
This routine returns the similarity of the a compressed image with a pixmap. The value returned
is between 1 ( very different) and 254 (very similar) and 255 means the two are identical.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
GetSimilarity(PixMapHandle src,Rect *srcRect,ImageDescriptionHandle desc,Ptr data,Fixed *similarity)
= {0x7000+0x001d,0xAAA3}
;
/*************************
GetImageDescriptionCTable
This returns the color table stored in the given image descriptor. This is usually called only by
Codecs. The color table should be disposed with DisposCTable when your are done with it.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
GetImageDescriptionCTable(ImageDescriptionHandle desc,CTabHandle *ctable)
= {0x7000+0x001e,0xAAA3}
;
/*************************
SetImageDescriptionCTable
This sets the color table stored in the given image descriptor to the given color table.
This should be called only by Codecs.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
SetImageDescriptionCTable(ImageDescriptionHandle desc,CTabHandle ctable)
= {0x7000+0x001f,0xAAA3}
;
/*************************
GetImageDescriptionExtension
This gets the extended data stored in the given image descriptor. This is usually
done only by Codecs. The extended data is specific to the CodecType which created
the ImageDescription.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
GetImageDescriptionExtension(ImageDescriptionHandle desc,Handle *extension,long type,long index)
= {0x7000+0x0020,0xAAA3}
;
/*************************
SetImageDescriptionExtension
This appends extension data to the given image descriptor. This done only by Codecs.
The extended data is specific to the CodecType which created the ImageDescription.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
SetImageDescriptionExtension(ImageDescriptionHandle desc,Handle extension, long type)
= {0x7000+0x0021,0xAAA3}
;
/*************************
FindCodec
This routine returns the actual codec used when the special codec identifier ( i.e. bestSpeedCodec)
specCodec.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
FindCodec(CodecType cType,CodecComponent specCodec,
CompressorComponent *compressor,DecompressorComponent *decompressor)
= {0x7000+0x0023,0xAAA3}
;
/*************************
CompressPicture
This routine compresses a picture with the given parameters.
Quality determines the quality of the compressed image.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
CompressPicture(PicHandle srcPicture, PicHandle dstPicture,CodecQ quality,CodecType cType)
= {0x7000+0x0024,0xAAA3}
;
/*************************
FCompressPicture
The fancy version routine compresses a picture with the given parameters.
Quality determines the quality of the compressed image.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
FCompressPicture(PicHandle srcPicture, PicHandle dstPicture,
short colorDepth, CTabHandle clut,CodecQ quality,
sBoolean doDither,sBoolean compressAgain,ProgressProcRecordPtr progressProc,
CodecType cType,CompressorComponent codec)
= {0x7000+0x0025,0xAAA3}
;
/*************************
CompressPictureFile
This is the same as CompressPicture, except the picture is read from the PICT file specified by sRefNum,
and written to dRefNum.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
CompressPictureFile(short srcRefNum, short dstRefNum,CodecQ quality,CodecType cType)
= {0x7000+0x0026,0xAAA3}
;
pascal OSErr
FCompressPictureFile(short srcRefNum, short dstRefNum,short colorDepth, CTabHandle clut,
CodecQ quality, sBoolean doDither,sBoolean compressAgain,ProgressProcRecordPtr progressProc,
CodecType cType,CompressorComponent codec)
= {0x7000+0x0027,0xAAA3}
;
/*************************
GetPictureFileHeader
This returns the picFrame for the picture is in the PICT file specified by refnum.
Return values:
noErr
paramErr
memFullErr
*/
pascal OSErr
GetPictureFileHeader(short refNum,Rect *frame,OpenCPicParams *header)
= {0x7000+0x0028,0xAAA3}
;
/*************************
DrawPictureFile
This draws the picture from the given PICT file in the current grafport at the
position specified by rect.
Return values:
noErr
paramErr
memFullErr
*/
pascal OSErr
DrawPictureFile(short refNum,Rect *frame,ProgressProcRecordPtr progressProc)
= {0x7000+0x0029,0xAAA3}
;
/*************************
DrawTrimmedPicture
This removes as much data as possible which does not intersect the given mask region from the srcPicture.
The result is drawn to the current port and frame.
*/
pascal OSErr
DrawTrimmedPicture(PicHandle srcPicture,Rect *frame,RgnHandle trimMask,sBoolean doDither,
ProgressProcRecordPtr progressProc)
= {0x7000+0x002e,0xAAA3}
;
/*************************
DrawTrimmedPictureFile
This removes as much data as possible which does not intersect the given mask region from the PICT file specified
by srcRefNum. The result is placed in the PICT file specified by dstRefNum if dstRefNum is not an empty file,
whatever data was in it is lost.
*/
pascal OSErr
DrawTrimmedPictureFile(short srcRefnum,Rect *frame,RgnHandle trimMask,sBoolean doDither,
ProgressProcRecordPtr progressProc)
= {0x7000+0x002f,0xAAA3}
;
/*************************
MakeThumbnail creates a Thumbnail picture from the given PICT file. The thumbnail is
optimized for the given pixel depth.
Depth is 1,2,4,8,16,24,32 for
for color, or 33,34,36,40 for 1,2,4, and 8 bit/pixel grayscale. If depth is zero,
the best depth for the given pixture is used.
Return values:
noErr
codecErr
paramErr
memFullErr
*/
pascal OSErr
MakeThumbnailFromPicture(PicHandle picture,short colorDepth,PicHandle thumbnail,
ProgressProcRecordPtr progressProc)
= {0x7000+0x002a,0xAAA3}
;
/*************************
MakeThumbnail creates a Thumbnail picture from the given PICT file. The thumbnail is
optimized for the size of the given rect and the given pixel depth.
Depth is 1,2,4,8,16,24,32 for
for color, or 33,34,36,40 for 1,2,4, and 8 bit/pixel grayscale. If depth is zero,
the best depth for the given pixture is used.
Return values:
noErr
codecErr
paramErr
memFullErr
*/
pascal OSErr
MakeThumbnailFromPictureFile(short refNum,short colorDepth,PicHandle thumbnail,
ProgressProcRecordPtr progressProc)
= {0x7000+0x002b,0xAAA3}
;
/*************************
MakeThumbnail creates a Thumbnail picture from the given pixmap. The thumbnail is
optimized for the given pixel depth. Depth is 1,2,4,8,16,24,32 for
for color, or 33,34,36,40 for 1,2,4, and 8 bit/pixel grayscale. If depth is zero,
the best depth for the given pixture is used.
Return values:
noErr
codecErr
paramErr
memFullErr
*/
pascal OSErr
MakeThumbnailFromPixMap(PixMapHandle src,Rect *srcRect,short colorDepth,PicHandle thumbnail,
ProgressProcRecordPtr progressProc)
= {0x7000+0x002c,0xAAA3}
;
/*************************
TrimImage
This removes as much data as possible which does not intersect the given mask region from the compressed image .
The trimMask is aligned with the entire original image.
*/
pascal OSErr
TrimImage(ImageDescriptionHandle desc,Ptr inData,long inBufferSize,DataProcRecordPtr dataProc,
Ptr outData,long outBufferSize,FlushProcRecordPtr flushProc,Rect *trimRect,
ProgressProcRecordPtr progressProc)
= {0x7000+0x002d,0xAAA3}
;
/*************************
ConvertImage
This routine converts compressed data from one format to another format or within
the same format with new parameters.
ColorDepth tells the codec the pixel depth at which this image will most likely be viewed.
Some codecs will use this to determine the color resolution of the compressed image. You
can determine which depths are supported by GetCodecInfo or GetCodecDepthList. If colorDepth is
zero the best matching depth available for the compressor is used. If the depth you specify
is not available the closest possible depth that the compressor can do is used.
DstRect determines the size of the resulting image - if it is nil, the original image
size will be used.
The data is taken from the pointer srcData, and is converted and placed into the
Ptr dstData, which should be the size of the worst case converted data see GetCompressionSize).
Quality, type and id define the compression parameters for the new data.
The dstPixMap, dstRect, mode and mask determine how the image will be displayed
(similar to copybits).
If matrix is not nil, it is used to position the decompressed image in the destination,
this can be used to perform flips, warps or rotations.
Return values:
noErr
codecErr
noCodecErr
paramErr
memFullErr
*/
pascal OSErr
ConvertImage(ImageDescriptionHandle srcDD,Ptr srcData,short colorDepth,CTabHandle clut,
CodecQ accuracy,CodecQ quality,CodecType cType,CodecComponent codec,
ImageDescriptionHandle dstDD,Ptr dstData)
= {0x7000+0x0030,0xAAA3}
;
/*************************
MakeDitherTable creates a dither table for doing fast dithering from using the given
gdevice.
return results:
noErr
memFullErr
paramErr
*/
pascal OSErr
MakeDitherTable(GDHandle gdev,DTabHPtr *ditherTable)
= {0x7000+0x0031,0xAAA3}
;
/*************************
DisposeDitherTable disposes a dither table made by MakeDitherTable.
noErr
paramErr
*/
pascal OSErr
DisposeDitherTable(DTabHPtr ditherTable)
= {0x7000+0x0032,0xAAA3}
;
/*************************
GetCompressedPixMapInfo extracts the compressed image info packed into a pixmap when passed
to StdPix.
noErr
paramErr
*/
pascal OSErr
GetCompressedPixMapInfo(PixMapPtr pix,ImageDescriptionHandle *desc,Ptr *data,long *bufferSize,
DataProcRecord *dataProc,ProgressProcRecord *progressProc)
= {0x7000+0x0037,0xAAA3}
;
/*************************
SetCompressedPixMapInfo encodes the compressed image info packed into a pixmap for use when
passed to StdPix.
noErr
paramErr
*/
pascal OSErr
SetCompressedPixMapInfo(PixMapPtr pix,ImageDescriptionHandle desc,Ptr data,long bufferSize,
DataProcRecordPtr dataProc,ProgressProcRecordPtr progressProc)
= {0x7000+0x0038,0xAAA3}
;
/*************************
TransformRgn encodes the compressed image info packed into a pixmap for use when
passed to StdPix.
noErr
(results of QDError)
*/
pascal OSErr
TransformRgn(MatrixRecord *matrix, RgnHandle rgn)
= {0x7000+0x0039,0xAAA3}
;
#endif __CODEC__